home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / qbsub10.arc / KEYDMO.ASC < prev    next >
Text File  |  1986-06-25  |  2KB  |  69 lines

  1. ' KEYDMO.ASC -- MSDOS QuickBASIC GETKEY.SUB subroutines test    25 June 86
  2. '        by David L. Poskie     (608) 274-9560
  3. '                  7118 Raymond Rd. Madison, WI 53719
  4. ' Please run any suggestions, corrections, additions, or changes by me.
  5. ' I can be messaged on all the major Madison, WI RBBS's.
  6.  
  7. '   Compile syntax: BASCOM KEY.ASC /D; |  LINK KEY;
  8.     
  9. GOTO Start
  10.     Rem    $Include: 'OMNI.SUB'
  11.  
  12. Start:
  13.     COLOR 14 , 3 , 8
  14.     CLS
  15.     LOCATE 3 , 1
  16.     Text$ = "GetKey subroutines test . . ."
  17.     GOSUB Center
  18.     GOSUB GetKeyPress
  19.     CLS
  20.     Text$ = "Well, GetKeyPress seems to work"
  21.     GOSUB Center
  22.     PRINT
  23.     Temp$ = ""
  24.     Text$ = "Type in a short string of"
  25.     GOSUB Center
  26.     Text$ = "mixed-case characters: "
  27.     GOSUB CenterStay
  28.     LINE INPUT Temp$
  29.     GOSUB GetUpperCase
  30.     Text$ = "Here's your string in upper case:"
  31.     GOSUB Center
  32.     PRINT
  33.     Text$ = Temp$
  34.     GOSUB Center
  35.     GOSUB GetKeyPress
  36.     LOCATE 12 ,1
  37.     Text$ = "In this last test, press any key"
  38.     GOSUB Center
  39.  
  40. Loop:
  41.     LOCATE 14 ,1
  42.         Text$ = "Press <ESC> to exit this test and the program"
  43.     GOSUB Center    
  44.     Text$ = "Press a key . ."
  45.     GOSUB Center
  46.     ' Get the extended key code & ASCII code of the key just pressed
  47.     GOSUB GetKeyCode
  48.     Text$ = "ASCII key code is" + STR$(KeyCode)
  49.     GOSUB Center    
  50.     Text$ = " Extended code is" + STR$(ExtendedCode)
  51.     GOSUB Center
  52.     Text$ = "Character is " + CHR$(KeyCode)
  53.     GOSUB Center
  54.     Dly = 2                    ' 2 seconds delay
  55.     GOSUB Delay
  56.     Dly = 0                 ' Set up to use ClearOut
  57.     WHILE INKEY$ <> ""            ' Clear the keyboard buffer
  58.     WEND
  59.     IF KeyCode = 27                            _
  60.        AND ExtendedCode = 0                        _
  61.            THEN GOTO LoopExit                    _
  62.            ELSE Num = 4 :                        _
  63.             GOSUB ClearOut :                    _
  64.             GOTO Loop
  65.  
  66. LoopExit:
  67. SYSTEM
  68. ' >>>>> Physical EOF KEYDMO.ASC 25 June 86
  69.